<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>CSS 属性 - 逆向播放</title>
  <style>
    body {
      padding: 0 40px;
      color: #333;
    }

    img {
      width: 200px;

      /* alternate 控制动播放时是否逆向播放 */
      animation: rotate 1s alternate 2;

      animation-name: rotate;
      animation-duration: 1s;
      animation-iteration-count: 2;
      /* 逆方向播放 */
      animation-direction: alternate;
    }

    @keyframes rotate {
      from {
        transform: rotate(0deg);
      }

      to {
        transform: rotate(360deg);
      }
    }
  </style>
</head>
<body>
  <h3>逆向播放</h3>
  <p>设置动画执行完毕后，是否允许逆向播放回到原始状态。</p>

  <img src="./images/rotate.png" alt="">
</body>
</html>